#!/usr/bin/env python
import sys

sys.path.append("/work/opt/analytic/my_python")
from lib.HandleMysql import *
from lib.handle_mongo import *

reload(sys)
sys.setdefaultencoding('utf-8')


#mysql - stats
def set_stats_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_58_stats')
    conn.connect()
    return conn

#mysql - order
def set_order0_conn():
    conn = HandleMysql('192.168.12.81', '58885', 'syzn58user_rd', 'FwE6dfgtpas12t6m', 'dbwww58com_pay_order_0')
    conn.connect()
    return conn

#mysql - order
def set_order1_conn():
    conn = HandleMysql('192.168.12.81', '58885', 'syzn58user_rd', 'FwE6dfgtpas12t6m', 'dbwww58com_pay_order_1')
    conn.connect()
    return conn

#mysql - order
def set_order2_conn():
    conn = HandleMysql('192.168.12.81', '58886', 'syzn58user_rd', 'FwE6dfgtpas12t6m', 'dbwww58com_pay_order_2')
    conn.connect()
    return conn

#mysql - order
def set_order3_conn():
    conn = HandleMysql('192.168.12.81', '58886', 'syzn58user_rd', 'FwE6dfgtpas12t6m', 'dbwww58com_pay_order_3')
    conn.connect()
    return conn

#mysql - stats
def online_revenue_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_online_revenue_stats')
    conn.connect()
    return conn


def zhiding_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_58_stats')
    conn.connect()
    return conn

#mysql - dict
def dict_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_base_dicts')
    conn.connect()
    return conn

#mysql - open
def wuba58_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_58_stats')
    conn.connect()
    return conn


def top_conn():
    conn = HandleMysql('topinfo-s.db.58dns.org', '58885', 'topolr58user', "qy#u$#3sfuHn$qJe", 'dbwww58com_topinfo')
    conn.connect()
    return conn

#mysql - dict
def set_dict_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_base_dicts')
    conn.connect()
    return conn

#mysql - ads
def set_ads_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_precision_ads')
    conn.connect()
    return conn

#mysql - infobright
def set_ib_conn():
    conn = HandleMysql('10.5.20.15', '5029', 'root', 'group_buytj1140', '58')
    conn.connect()
    return conn

#mysql - topinfo_tanxiao
def set_mongo_conn():
    conn = connect_db(host='bi05.service.58dns.org', db='topinfo')
    return conn

#mysql - top
def set_top_conn():
    conn = HandleMysql('topinfo-s.db.58dns.org', '58885', 'topolr58user', "qy#u$#3sfuHn$qJe", 'dbwww58com_topinfo')
    conn.connect()
    return conn


def set_channel_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_precision_ads')
    conn.connect()
    return conn


def set_zhiding_conn():
    conn = HandleMysql('10.5.20.16', '58885', 'ec_stat', 'L#c8UM5RGh5C', 'dbwww58com_zhiding_stats')
    conn.connect()
    return conn
